package com.databasedesign.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.databasedesign.pojo.po.Student;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudentDao extends BaseMapper<Student> {
    @Select("select * from student where gender = '女'")
    List<Student> GetAll();

    @Select("select * from student where student_id = #{StudentId} or student_number = #{StudentId} ")
    Student GetByStudentId(String StudentId);


    @Select("SELECT DISTINCT address FROM `student` where gender = '女'")
    List<String> GetGirlAddress();


    @Select("SELECT * FROM `student` where gender = '女' and address = #{address} order by college,subject")
    List<Student> GetGirlByAddress(String address);

    @Select("SELECT DISTINCT address FROM `student` where gender = '男'")
    List<String> GetBoyAddress();


    @Select("SELECT * FROM `student` where gender = '男' and address = #{address} order by college,subject")
    List<Student> GetBoyByAddress(String address);

    @Select("SELECT * FROM `student` where college = #{CollegeOrSubject} or subject= #{CollegeOrSubject}")
    List<Student> GetStudentByCollegeOrSubject(String CollegeOrSubject);
}
